package com.mask.sca.system.controller;

import com.mask.sca.system.entity.DictItem;
import com.mask.sca.system.service.DictItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/system/dict/item")
public class DictItemController {
    @Autowired
    private DictItemService dictItemService;

    @GetMapping("/list")
    public List<DictItem> list() {
        return dictItemService.list();
    }

    @GetMapping("/{id}")
    public DictItem get(@PathVariable Long id) {
        return dictItemService.getById(id);
    }

    @PostMapping("/add")
    public boolean add(@RequestBody DictItem dictItem) {
        return dictItemService.save(dictItem);
    }

    @PutMapping("/update")
    public boolean update(@RequestBody DictItem dictItem) {
        return dictItemService.updateById(dictItem);
    }

    @DeleteMapping("/delete/{id}")
    public boolean delete(@PathVariable Long id) {
        return dictItemService.removeById(id);
    }
} 